package com.dependencies.springjdbc.service;

import com.dependencies.springjdbc.dao.StudentRepository;
import com.dependencies.springjdbc.model.Student;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author zhizhou   2024/8/23 09:24
 */
@Service
public class StudentService {
    
    @Autowired
    private StudentRepository studentRepository;
    
    public int addStudent(Student Student) {
        return studentRepository.addStudent(Student);
    }
    
    public List<Student> findAllStudents() {
        return studentRepository.findAllStudents();
    }
    
    public Student findStudentById(Long id) {
        return studentRepository.findStudentById(id);
    }
    
    public int updateStudent(Student Student) {
        return studentRepository.updateStudent(Student);
    }
    
    public int deleteStudent(Long id) {
        return studentRepository.deleteStudent(id);
    }
    
    public Map<String, Object> findStudentAsMap(Long id) {
        return studentRepository.findStudentAsMap(id);
    }
    
    public List<Map<String, Object>> findAllStudentsAsMapList() {
        return studentRepository.findAllStudentsAsMapList();
    }
    
    public int[] batchAddStudents(List<Object[]> batchArgs) {
        return studentRepository.batchAddStudents(batchArgs);
    }
}
